package org.mbds.android.p2p.listeners;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Map;

import org.mbds.android.p2p.services.P2pService;

import android.annotation.SuppressLint;
import android.net.wifi.p2p.WifiP2pDevice;
import android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener;
import android.widget.Toast;
	
public class P2pServiceDnsTextRecordListener {
	
	ArrayList<WifiP2pDevice> mSismappServiceDevices;
	P2pService mService;
	
	DnsSdTxtRecordListener mListener;
	
	public P2pServiceDnsTextRecordListener(P2pService service){
		mService = service;
		mSismappServiceDevices = new ArrayList<WifiP2pDevice>();
		initializeDnsTextRecordListener();
	}
	
	public void initializeDnsTextRecordListener(){
		mListener = new DnsSdTxtRecordListener() {
			
			@SuppressLint("NewApi")
			@Override
			public void onDnsSdTxtRecordAvailable(String fulldomain,
					Map<String, String> record, WifiP2pDevice device) {
				Toast.makeText(mService.getApplicationContext(), "TXT", Toast.LENGTH_SHORT).show();
				mSismappServiceDevices.add(device);
			}
		};
	}
	
	public DnsSdTxtRecordListener getListener(){
		return mListener;
	}
	
	public ArrayList<WifiP2pDevice> getSismappServiceDevices(){
		return mSismappServiceDevices;
	}
}
